home *** CD-ROM | disk | FTP | other *** search
- /* This program dowjones.c created by Delrina and assigned to the DowJones session*/
- /* runs an automated logon script for connecting to Dow Jones. */
-
- /* $Revision: 1.2 $ */
- /* $Date: 27 Oct 1995 14:42:42 $ */
-
- /* Define main function, which is always the starting point of C programs. */
- /* (The term "void" indicates that the function returns no value.) */
- void main()
- {
- /* Declare variables */
- long ScriptHandle;
- int ReturnValue;
- char Buffer[128], LogLine[128];
-
- /* Initialize variables */
- ReturnValue = 0;
- ScriptHandle = 0;
-
- /* Establish a link between this script program and Delrina WinComm PRO */
- ScriptHandle = dcInitialize(0,0,0,0);
-
- /* Exit if intialization of link with Delrina WinComm PRO failed */
- if (ScriptHandle == 0) exit();
-
- /* Set local echo on */
- ReturnValue = dcSetLocalEcho(ScriptHandle, 1);
-
- /* Type a '@' then <enter> */
- if (ReturnValue >= 0)
- ReturnValue = dcTypeText(ScriptHandle, 0, "@");
-
- /* Pause */
- if (ReturnValue >= 0)
- dcSleep(ScriptHandle, 1000L);
-
- /* Type a <enter> */
- if (ReturnValue >= 0)
- ReturnValue = dcTypeText(ScriptHandle, 0, "\r");
-
- /* Turn local echo off */
- if (ReturnValue >= 0)
- ReturnValue = dcSetLocalEcho(ScriptHandle, 0);
-
- /* Wait for one of three prompts possible with Tymenet or Telenet */
- if (ReturnValue >= 0)
- ReturnValue = dcWaitForPrompt(ScriptHandle, 3, "ERMINAL=\0r name: \0identifier", 300L, 32000L);
-
- /* If Tymenet do this block */
- if (ReturnValue == 0)
- {
- /* Type an <enter> */
- ReturnValue = dcTypeText(ScriptHandle, 0, "\r");
-
- /* Wait for a prompt */
- if (ReturnValue >= 0)
- ReturnValue = dcWaitForPrompt(ScriptHandle, 1, "\r\n\r\n@", 300L, 32000L);
-
- /* Type text to request Dow Jones */
- if (ReturnValue >= 0)
- ReturnValue = dcTypeText(ScriptHandle, 0, "c dow\r");
- }
- /* If Telenet do this block */
- else
- {
- /* Type an 'a' */
- ReturnValue = dcTypeText(ScriptHandle, 0, "a");
-
- /* Wait for a prompt */
- if (ReturnValue >= 0)
- ReturnValue = dcWaitForPrompt(ScriptHandle, 1, "log in: ", 300L, 32000L);
-
- /* Type text requesting Dow Jones */
- if (ReturnValue >= 0)
- ReturnValue = dcTypeText(ScriptHandle, 0, "dow1;;");
- }
-
- /* Wait for a prompt */
- if (ReturnValue >= 0)
- ReturnValue = dcWaitForPrompt(ScriptHandle, 1, "SE????\r\n", 300L, 32000L);
-
- /* Type text to request Dow Jones */
- if (ReturnValue >= 0)
- ReturnValue = dcTypeText(ScriptHandle, 0, "djns\r");
-
- /* Pause */
- if (ReturnValue >= 0)
- ReturnValue = dcSleep(ScriptHandle, 2000L);
-
- /* Get Password value from Runtime Values dialog box and add to logline */
- if (ReturnValue >= 0)
- {
- ReturnValue = dcGetRuntimeValue(ScriptHandle, 3, 1, 128, Buffer);
- strncat(LogLine, Buffer, strlen(Buffer)-1);
- }
-
- /* Get User ID value from Runtime Values dialog box and add to logline */
- if (ReturnValue >= 0)
- {
- ReturnValue = dcGetRuntimeValue(ScriptHandle, 2, 1, 128, Buffer);
- strcat(LogLine, Buffer);
- }
-
- /* Type the logline */
- if (ReturnValue >= 0)
- ReturnValue = dcTypeText(ScriptHandle, 0, LogLine);
-
- /* Terminate link between Delrina WinComm PRO and script program */
- dcTerminate(ScriptHandle, 0);
- }
-
-
-